package com.zhuhao.basic.completablefuture.tuils;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

import java.util.concurrent.*;

/**
 * @Author zhuhao
 * @Date 2022/4/15 16:09
 * @desc
 */
public class ThreadPoolConfig {

    public static ExecutorService executorService() {
        ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
                .setNameFormat("custom-thread-pool").build();

        return new ThreadPoolExecutor(100, 200,
                0, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
    }
}
